//
//  main.swift
//  TestApp
//
//  Created by andyge on 15/8/3.
//  Copyright © 2015年 gejingguo. All rights reserved.
//

import Foundation
import SwiftTCP

print("hello")
testFunc()

var tcpServer = TcpServer(ip: "127.0.0.1", port: 8900)

var err = tcpServer.listen()
if err != nil {
    print(err!.errorCode)
    print(err!.errorMsg)
    exit(0)
}

var poller: Poller = KEventPoller(max: 10, tcpDelegate: TcpBinaryDelegate(), interval: 10)

var po: PollObject = tcpServer
err = poller.addPollObject(&po)
if err != nil {
    print(err!.errorCode)
    print(err!.errorMsg)
    exit(0)
}

print("poller mainLoop..")
poller.mainLoop()
